import {createRouter, createWebHashHistory} from 'vue-router'
// 1. 定义路由组件.
// 也可以从其他文件导入
import Home from '../pages/home.vue'
import ItemDetail from '../pages/itemDetail.vue'
import OrderList from '../pages/orderList.vue'
import OrderDetail from '../pages/orderDetail.vue'
import MemberIntro from '../pages/memberIntro.vue'
import MemberIntro2 from '../pages/memberIntro2.vue'
import Services from '../pages/services.vue'
import ServicesList from '../pages/servicesList.vue'
import ServicesDetail from '../pages/servicesDetail.vue'
import Comment from '../pages/comment.vue'
// 2. 定义一些路由
// 每个路由都需要映射到一个组件。
// 我们后面再讨论嵌套路由。
const routes = [
  { path: '/', component: Home },
  { path: '/itemDetail', component: ItemDetail },
  { path: '/orderList', component: OrderList },
  { path: '/orderDetail', component: OrderDetail },
  { path: '/memberIntro', component: MemberIntro},
  { path: '/memberIntro2', component: MemberIntro2},
  { path: '/services', component: Services},
  { path: '/servicesList', component: ServicesList},
  { path: '/servicesDetail', component: ServicesDetail},
  { path: '/comment', component: Comment}
]

// 3. 创建路由实例并传递 `routes` 配置
// 你可以在这里输入更多的配置，但我们在这里
// 暂时保持简单
export const router = createRouter({
  // 4. 内部提供了 history 模式的实现。为了简单起见，我们在这里使用 hash 模式。
  history: createWebHashHistory(),
  routes, // `routes: routes` 的缩写
})